package com.xr.blog.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import lombok.Data;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;

/**
 * 
 * 
 * @author XRJ
 * @email 1033835209@qq.com
 * @date 2020-07-07 20:31:38
 */
@Data
@TableName("sys_user")
public class SysUser implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	@TableId
	private Long id;
	/**
	 * 用户名
	 */
	@NotBlank(groups = {Insert.class, Update.class},message = "用户名不能为空")
	private String username;
	/**
	 * 用户昵称
	 */
	private String nickname;
	/**
	 * 密码
	 */
	@NotBlank(groups = {Insert.class,Update.class},message = "密码不能为空")
	@Length(groups = {Insert.class,Update.class},min = 6,message = "密码不能小于6位")
	private String password;
	/**
	 * 密码盐
	 */
	private String salt;
	/**
	 * 邮箱
	 */
	@Email(groups = {Insert.class,Update.class},message = "邮箱格式不正确")
	private String email;
	/**
	 * 邮箱的MD5值，用于显示头像
	 */
	private String emailMd5;
	/**
	 * 最后登录时间
	 */
	private Date lastLoginTime;
	/**
	 * 创建时间
	 */
	private Date createTime;
	/**
	 * 登录失败次数，超过一定次数禁止登录
	 */
	private Integer loginFail;
	/**
	 * 是否禁用 0：否 1：是
	 */
	private Integer isDisable;

	/** 角色对象 */
	@TableField(exist = false)
	private List<SysRole> roles;

}
